package com.itheima.consumer.mq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalTime;

@Slf4j
@Component
public class SpringAmpqListener {

    @RabbitListener(queues="simple.queue")
    public void ListenerSimple(String msg){
        log.info("监听到simple。queue事件消息为{}",msg);

    }
    @RabbitListener(queues="work.queue")
    public void ListenerWork1(String msg){
        System.out.println("消费者1接受到消息" + msg+","+ LocalTime.now());

    }
    @RabbitListener(queues="work.queue")
    public void ListenerWork2(String msg){
        System.err.println("消费者2接受到消息" + msg+","+ LocalTime.now());

    }
    @RabbitListener(queues="fanout.queue1")
    public void ListenerFanout1(String msg){
        log.info("消费者1监听到fanout.queue1事件消息为{}",msg);

    }
    @RabbitListener(queues="fanout.queue2")
    public void ListenerFanout2(String msg){
        log.info("消费者2监听到fanout.queue1事件消息为{}",msg);

    }

}
